
<link href="<?php echo CSS_User_URL; ?> /Profile_Setting_style.css" rel="stylesheet" type="text/css">                 

<!--<form name="PersionalInfo" id="PersionalInfo">-->
<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'update-persional-form',
    'action' => array('User/UpdatePersionalInfo'),
    'enableAjaxValidation' => true,
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
    'clientOptions' => array(
        'validateOnSubmit' => true,
    ),
        ));
?>
<div class="setting_area">
    <h3 class="page_title">Thiết lập thông tin cá nhân</h3>
    <div class="setting_section"> 
        <div class="setting_module">
            <div class="setting_field">
                <span class="field_title">Họ và tên:</span>

                <?php echo $form->textField($NguoiDung, 'Ten'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'Ten'); ?></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Bí danh:</span>
                <?php echo $form->textField($NguoiDung, 'BiDanh'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'BiDanh'); ?></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Slogan:</span>
                <?php echo $form->textField($NguoiDung, 'Slogan'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'Slogan'); ?></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Địa chỉ:</span>
                <?php echo $form->textField($NguoiDung, 'DiaChi'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'DiaChi'); ?></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Số điện thoại:</span>
                <?php echo $form->textField($NguoiDung, 'SDT'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'SDT'); ?></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Ngày sinh:</span>
                <?php echo $form->textField($NguoiDung, 'NgaySinh'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'NgaySinh'); ?></span>
            </div>
            <div class="setting_field">
                <span class="field_title">CMND:</span>
                <?php echo $form->textField($NguoiDung, 'CMND'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'CMND'); ?></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Cơ quan:</span>
                <?php echo $form->textField($NguoiDung, 'CoQuan'); ?>
                <span class="field_status status_valid"><?php echo $form->error($NguoiDung, 'CoQuan'); ?></span>
            </div>
        </div>
        <div class="setting_image">
            <div class="image_parent">
                <img src="<?php echo Yii::app()->baseUrl; ?>/images/ProfileImage/<?php echo $NguoiDung->Avatar; ?>" alt="Ideawebsite.com">
            </div>
            <a href="javascript:void(0)" class="button_base"><?php echo CHtml::activeFileField($NguoiDung, 'Avatar', array('class' => '')); ?></a>

        </div>
    </div>
</div>
<div class="pages_bar center-child">
    <!--<a href="#" class="button_base" ><span>Cập nhật</span></a>-->
    <!--<button id="btnCapNhat" class="ladda-button" data-style="expand-right"><span class="ladda-label">Cập nhật</span></button>-->
    <?php echo CHtml::submitButton('Cập nhật', array('class' => 'button_base')); ?>
    <!--<a href="#" class="button_base"><span>Làm lại</span></a>-->
</div>
<?php $this->endWidget(); ?>
<div class="setting_area">
    <h3 class="page_title">Thay đổi mật khẩu</h3>
    <div class="setting_section"> 
        <div class="setting_module">
            <div class="setting_field">
                <span class="field_title">Password cũ:</span>
                <input id="inpOldPass" name="OldPassword" type="password"/>
                <span class="field_status status_valid"></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Password mới:</span>
                <input id="inpNewPass" name="NewPassword" type="password"/>
                <span class="field_status status_valid"></span>
            </div>
            <div class="setting_field">
                <span class="field_title">Nhập lại Password mới:</span>
                <input id="inpNewPass_r" name="NewPassword_r" type="password"/>
                <span class="field_status status_valid"></span>
            </div>

        </div>
        <div class="setting_image">
            <img src="<?php echo Yii::app()->baseUrl; ?>/images/pencil.png" alt="Ideawebsite.com">
        </div>
    </div>
</div>
<div>
    <p id="errorMK"></p>
</div>
<div class="pages_bar center-child">
    <input id="btnCapNhatMK" type="button" class="button_base" value="Cập nhật"/>
    <!--<span class="ladda-label">Cập nhật</span>-->   
</div>

<script>
    $(document).ready(function() {
        $("#btnCapNhatMK").click(function() {
            if ($('#inpNewPass_r').val() !== $('#inpNewPass').val()) {
                $('#inpNewPass_r').parent().find('.field_status').html('Password mới không khớp');
            } else {
                URL = '<?php echo Yii::app()->createUrl("User/UpdateMatKhau"); ?>';
                $.post(URL, {Old: $('#inpOldPass').val(), New: $('#inpNewPass').val()}, function(data) {
                    $('#errorMK').html(data);

                });
            }
        });
    });
</script>